﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace L04
{
    class CzPoint
    {
        public double x;
        public double y;

        public CzPoint()
        {

        }
        public CzPoint(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        public double getx()
        {
            return x;
        }
        public double gety()
        {
            return y;
        }
        public void Move(int a, int b)
        {
            x = x + a;
            y = y + b;
        }
        public static string operator ==(CzPoint c1, CzPoint c2)
        {
            if (c1.x == c2.x || c1.y == c2.y)
            {
                return "两点相等";
            }
            else return "两点不等";
        }
        public static string operator !=(CzPoint c1, CzPoint c2)
        {
            if (c1.x == c2.x || c1.y == c2.y)
            {
                return "两点相等";
            }
            else return "两点不等";
        }

    }
    class CzLine : CzPoint
    {
        static void Main(string[] args)
        {
            CzPoint A1 = new CzPoint(1, 2);
            CzPoint A2 = new CzPoint(3, 3);
            Console.WriteLine("{0}", A1 == A2);
            A1.Move(2, 1);
            Console.WriteLine("{0}", A1 == A2);
            CzLine A3 = new CzLine(2, 5);
            A3.Contains(2, 1);
            Console.ReadKey();
        }

        double a;
        double b;
        double y;
        double x;

        public double A
        {
            get { return a; }
        }
        public double B
        {
            get { return b; }
        }

        public CzLine(CzLine p1, CzLine p2)
        {
            this.a = (p2.y - p1.y) / (p2.x - p1.x);
            this.b = p1.y - this.a * p1.x;
        }

        public CzLine()
        {
        }
        public CzLine(double A, double B)
        {
            this.x = A;
            this.y = B;
        }
        public void Line1(double a, double b)
        {
            y = a * x + b;
        }
        public new void Move(int a, int b)
        {
            x = x + a;
            y = y + b;
        }
        public void Contains(double c, double d)
        {
            if (a * x + b - d == 0)
            {
                Console.WriteLine("在");
            }
            else
                Console.WriteLine("不在");
        }

    }
}
